<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_goods', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("userid")->comment("用户ID");
            $table->integer("order_id")->comment("订单ID");
            $table->string("order_sn",50)->comment("订单号");
            $table->integer("goods_id")->comment("商品ID");
            $table->string("goods_name",150)->comment("商品名");
            $table->string("goods_image",150)->comment("商品图片");
            $table->decimal("goods_price",10,2)->default(0.00)->comment("商品价格");
            $table->integer("sku_id")->comment("规格ID");
            $table->string("sku_name",80)->comment("规格名称");
            $table->decimal("sku_price",10,2)->comment("规格价格");
            $table->integer("color_id")->comment("颜色ID");
            $table->string("color_name",50)->comment("颜色名称");
            $table->integer("goods_num")->default(1)->comment("购买数量");
            $table->decimal("goods_amount",10,2)->default(0)->comment("商品总价");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_goods');
    }
}
